/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.machineryrental.converters;

import cz.muni.fi.pa165.machineryrental.dto.CustomerType;
import cz.muni.fi.pa165.machineryrental.entities.CustomerTypeEnum;

/**
 *
 * @author jostri
 */
public class CustomerTypeConverter {
	
	/**
	 * Converts type of customer from entities layer.
	 * 
	 * @param customerTypeEnum CustomerType from entities layer to dto layer
	 * @return Customer type on service layer.
	 */
	public static CustomerType convertToDTO(CustomerTypeEnum customerTypeEnum) {
		
		return customerTypeEnum == CustomerTypeEnum.BUSINESS ? CustomerType.BUSINESS : CustomerType.PERSONAL;
		
	}
	
	/**
	 * Converts type of customer from service layer to entities layer.
	 * 
	 * @param customerTypeEnum CustomerType from service layer
	 * @return Customer type on entities layer.
	 */
	public static CustomerTypeEnum convertToEntity(CustomerType customerType) {
		
		return customerType == CustomerType.BUSINESS ? CustomerTypeEnum.BUSINESS : CustomerTypeEnum.PERSONAL;
		
	}
	
}
